/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.evote.monitoreo.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Mendoza
 */
@Entity
@Table(name = "elector", catalog = "evote", schema = "")
@NamedQueries({
    @NamedQuery(name = "Elector.findAll", query = "SELECT e FROM Elector e"),
    @NamedQuery(name = "Elector.findByIdElector", query = "SELECT e FROM Elector e WHERE e.idElector = :idElector")})
public class Elector implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idElector", nullable = false)
    private Integer idElector;
    @JoinColumn(name = "Locacion_idLocacion", referencedColumnName = "idLocacion", nullable = false)
    @ManyToOne(optional = false)
    private Locacion locacionidLocacion;
    @JoinColumn(name = "Ciudadano_idCiudadano", referencedColumnName = "idCiudadano", nullable = false)
    @ManyToOne(optional = false)
    private Ciudadano ciudadanoidCiudadano;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "electoridElector")
    private List<Logelector> logelectorList;

    public Elector() {
    }

    public Elector(Integer idElector) {
        this.idElector = idElector;
    }

    public Integer getIdElector() {
        return idElector;
    }

    public void setIdElector(Integer idElector) {
        this.idElector = idElector;
    }

    public Locacion getLocacionidLocacion() {
        return locacionidLocacion;
    }

    public void setLocacionidLocacion(Locacion locacionidLocacion) {
        this.locacionidLocacion = locacionidLocacion;
    }

    public Ciudadano getCiudadanoidCiudadano() {
        return ciudadanoidCiudadano;
    }

    public void setCiudadanoidCiudadano(Ciudadano ciudadanoidCiudadano) {
        this.ciudadanoidCiudadano = ciudadanoidCiudadano;
    }

    public List<Logelector> getLogelectorList() {
        return logelectorList;
    }

    public void setLogelectorList(List<Logelector> logelectorList) {
        this.logelectorList = logelectorList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idElector != null ? idElector.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Elector)) {
            return false;
        }
        Elector other = (Elector) object;
        if ((this.idElector == null && other.idElector != null) || (this.idElector != null && !this.idElector.equals(other.idElector))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.evote.monitoreo.entity.Elector[idElector=" + idElector + "]";
    }

}
